package com.frogs.ucenter.v1.request;


import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.util.StringUtil;
import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.util.OrderPaymentEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;


/**
 * 用户订单添加请求参数类
 *
 * @author jzkangta
 */
public class UserOrderLogAddRequest extends Request {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3033099115641853372L;

	 private Integer userId = 0;//蛙鸣用户id
	 private String partnerOrderSn;
	 private Integer money = 0;//订单总价，单位分
	 private String detailJson;
	 private Integer payStatus = 0;//未支付、已支付、退款
	 private String remark;
	// private String payType="";
	 private String partnerUserId;//合作方userId
	 private String partnerId = "";//合作方Id
	 private String orderTime = "";//下单时间
	 private String shippingAddress;//收货地址
	 private String shippingName;//收货人
	 private String shippingPhone;//联系电话
	 private String shipmentStatus;//发货状态
	 
	
	public UserOrderLogAddRequest() {
		
	}
	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		this.userId = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(), 0);
		this.money = requestInfo.getIntParameter(ApiUrlParamEnum.money.getParamName(), 0);
		this.payStatus = requestInfo.getIntParameter(ApiUrlParamEnum.payStatus.getParamName(), 0);//OrderPayStatusEnum.PAY_STATUS_YES.getId());
		this.partnerId = requestInfo.getParameter(ApiUrlParamEnum.partnerId.getParamName(), "");
		this.partnerOrderSn = requestInfo.getParameter(ApiUrlParamEnum.partnerOrderSn.getParamName(), "");
		this.detailJson = requestInfo.getParameter(ApiUrlParamEnum.detailJson.getParamName(), "");
		this.partnerUserId = requestInfo.getParameter(ApiUrlParamEnum.partnerUserId.getParamName(), "");
		this.orderTime = requestInfo.getParameter(ApiUrlParamEnum.orderTime.getParamName(), "");
		this.shippingAddress = requestInfo.getParameter(ApiUrlParamEnum.sAddress.getParamName(), "");
		this.shippingName = requestInfo.getParameter(ApiUrlParamEnum.sName.getParamName(), "");
		this.shippingPhone = requestInfo.getParameter(ApiUrlParamEnum.sPhone.getParamName(), "");
		//this.payType = requestInfo.getParameter("payType", "");
		this.shipmentStatus = requestInfo.getParameter(ApiUrlParamEnum.shipmentStatus.getParamName(), OrderPaymentEnum.WATTING.getId()+"");
		this.remark = requestInfo.getParameter(ApiUrlParamEnum.remark.getParamName(), "");
		if(userId == 0 ) {
			throw new RequestIllegalException("传递错误的参数，请确认userId不能为空!");
		}
		
		if(StringUtil.isEmpty(partnerOrderSn)){
			throw new RequestIllegalException("error partnerOrderSn:" + partnerOrderSn);
		}
		/*if(StringUtil.isEmpty(payType)){
			throw new RequestIllegalException("error payType:" + payType);
		}*/
		if(StringUtil.isEmpty(detailJson)){
			throw new RequestIllegalException("error detailJson:" + detailJson);
		}
		if(StringUtil.isEmpty(partnerUserId)){
			throw new RequestIllegalException("error partnerUserId:" + partnerUserId);
		}
		if(StringUtil.isEmpty(orderTime)){
			throw new RequestIllegalException("error orderTime:" + orderTime);
		}
		if(StringUtil.isEmpty(shippingAddress)){
			throw new RequestIllegalException("error shippingAddress:" + shippingAddress);
		}
		if(StringUtil.isEmpty(shippingName)){
			throw new RequestIllegalException("error shippingName:" + shippingName);
		}
		if(StringUtil.isEmpty(shippingPhone)){
			throw new RequestIllegalException("error code:" + shippingPhone);
		}
		
		if(StringUtil.isEmpty(partnerId) ) {
			throw new RequestIllegalException("传递错误的参数，请确认合作方ID不能为空!");
		}
		if(money == 0 ) {
			throw new RequestIllegalException("传递错误的参数，请确认money不能为空!");
		}
		if(StringUtil.isEmpty(partnerUserId)) {
			throw new RequestIllegalException("传递错误的参数，请确认partnerUserId不能为空!");
		}
		if(payStatus == 0 ) {
			throw new RequestIllegalException("传递错误的参数，请确认payStatus不能为空!");
		}
		
		
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public String getPartnerOrderSn() {
		return partnerOrderSn;
	}

	public void setPartnerOrderSn(String partnerOrderSn) {
		this.partnerOrderSn = partnerOrderSn;
	}

	public Integer getMoney() {
		return money;
	}

	public void setMoney(Integer money) {
		this.money = money;
	}

	public String getDetailJson() {
		return detailJson;
	}

	public void setDetailJson(String detailJson) {
		this.detailJson = detailJson;
	}

	public Integer getPayStatus() {
		return payStatus;
	}

	public void setPayStatus(Integer payStatus) {
		this.payStatus = payStatus;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getPartnerUserId() {
		return partnerUserId;
	}

	public void setPartnerUserId(String partnerUserId) {
		this.partnerUserId = partnerUserId;
	}

	public String getPartnerId() {
		return partnerId;
	}

	public void setPartnerId(String partnerId) {
		this.partnerId = partnerId;
	}

	public String getOrderTime() {
		return orderTime;
	}

	public void setOrderTime(String orderTime) {
		this.orderTime = orderTime;
	}

	public String getShippingAddress() {
		return shippingAddress;
	}

	public void setShippingAddress(String shippingAddress) {
		this.shippingAddress = shippingAddress;
	}

	public String getShippingName() {
		return shippingName;
	}

	public void setShippingName(String shippingName) {
		this.shippingName = shippingName;
	}

	public String getShippingPhone() {
		return shippingPhone;
	}

	public void setShippingPhone(String shippingPhone) {
		this.shippingPhone = shippingPhone;
	}

	public String getShipmentStatus() {
		return shipmentStatus;
	}

	public void setShipmentStatus(String shipmentStatus) {
		this.shipmentStatus = shipmentStatus;
	}

	
	
}
